package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * @Author：yyj
 * @Package：com.atguigu.lease.common.exception
 * @Project：project01
 * @name：LeaseException
 * @Date：2024/11/19 17:05
 * @Filename：LeaseException
 */
@Data
public class LeaseException extends RuntimeException {
    private Integer code;
    private String message;

    public LeaseException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public LeaseException(ResultCodeEnum resultCodeEnum){
        this(resultCodeEnum.getCode(),resultCodeEnum.getMessage());
    }

    @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }

}
